/**
 * @file NetCtrl.h
 * @Synopsis
 * @author JzeTech
 * @version 0.1 beta
 * @date 2009-08-19
 */

 #ifndef _NETCTRL_H_
 #define _NETCTRL_H_

#include "Ipc.h"
#include "netCommon.h"
#include "netVideoPara.h"
#include "netStorage.h"
#include "netVoiceCall.h"
#include "netVideoRecord.h"
#include "netAlarm.h"
#include "netPtz.h"
#include "Thread.h"

void MainNetCtrl(void* args);
void NetDispatch(void* args);
void CloseVideoConnect(char* buf);
void CliToVideoServ(int fd, char* buffer, int bufLen);
void SendStartAndOrConnectionMsg(int on_off);
void ReplyConMsg(int fd, char *type);
void SendPrivateMessageToClient(int fd);
void ModifyOriginalConnectMesaage(char* ticketID, int flag);
void SendOriginalConnectionMsg(int fd);
void AuthToVideoServ(int fd, char* buff, int bufLen, int code);
void GetTicketAndDevDataID(char* buff, int bufLen, char* ticketID);
void ReplyAuthMsgToClient(int fd, int code, char *ticket);
void CreateAuthMsgXMLFile();
void SendAuthMsgToClient(int code, int fd);
void GetVideoParaFromServToCli(int fd, char* buffer, int bufLen, Codec_Param *videoParam);
void SendVideoParaFromCliToServ(int fd, char* buffer, int bufLen );
int CheckLocalClientPermission(int fd, char* buff, int bufLen, unsigned char code);
void TransmitVideoToLocalClient(int fd, char* buff, int bufLen, unsigned char code);
void InitLocalConf(int fd, int code);
void	GetHuXConf(int fd, char *buff, int blen);
void	SetHuXConf(int fd, char *buff, int blen);
void TransMjpgData(void* args);
void set_ppp_dialup(int fd,char* buff,int blen);
void get_ppp_dialup(int fd);
void send_ppp_status(int fd);
void get_ppp_status(char *buffer, int blen);
/**
 * @brief
 *
 * @param root
 * @param mhandle
 */
//void GetFrameStruct(mxml_node_t* root, FrameStruct* fameStruct);

/**
 * @brief
 *
 * @param root
 * @param mhandle
 */
void GetPicFormat(mxml_node_t* root, PicFormat* picFormat);

/**
 * @brief
 *
 * @param root
 * @param mhandle
 */
void GetVideoAttrs(mxml_node_t* root, VideoPara* videoPara);


/**
 * @brief
 *
 * @param root
 * @param mhandle
 */
void GetHideZone(mxml_node_t* root, HideZone* hideZone);

/**
 * @brief
 *
 * @param root
 * @param mhandle
 */
void GetRectanglePara(mxml_node_t *node, Rect* rect, int num);

/**
 * @brief
 *
 * @param root
 * @param mhandle
 */
void GetPicDetect(mxml_node_t* root, PicDetect* picDetect);

/**
 * @brief Get video Para
 *
 * @param fp
 * @param root
 * @param mhandle
 */
void SetMainVideoParas(FILE* fp, Video_Param* videoParam, int fd);
void GetHostIp();
void GetHostHW();
void GetHostMask();

void SetLocalNetConf(int fd, char *buff, int blen);
void SetSysConf(int fd, char *buff, int blen, int type);
void FetchLocalSysConf(int fd, int code);
void FetchLocalNetConf(int fd);
void SendStartOrEndMsg(int on_off, char *ticket);
void FetchLocalTmConf(int fd);
void FetchLocalSnapConf(int fd);
void FetchLocalSDiskConf(int fd);
void get_local_ver_info(int fd);
int download_upgrade_file(int fd);
//void TransLocalVoiceCall(int fd);
void LocalNetDispatch(void* args);
void TransMjpgCtrlData(void* args);
int fork_create(int *m_nProcessId ,char* strFilePath,char* strParam);
#endif
